Trims all elements in an array a certain number of characters.
#include <Array.au3>
_ArrayTrim ( $aArray, $iTrimNum [, $iTrimDirection [, $iBase [, $iUbound ]]] )
Parameters
$aArray | The array to trim the items of. |
$iTrimNum | The amount of characters to trim. |
$iTrimDirection | Optional: Default=0. 0 to trim left, 1 to trim right |
$iBase | Optional: Start Array index for sort, normally set to 0 or 1. |
$iUbound | Optional: Set the UBound for trimming which will only trim the defined number of entries instead of the whole array. |
Return Value
Success: | Returns the new trimmed array. |
Failure: | Returns the array unchanged. |
@Error: | 0 = No error. |
1 = If invalid array | |
2 = Invalid base boundry parameter | |
3 = Invalid end boundry parameter | |
4 = If $iTrimDirection is not a zero or a one |
Remarks
None.
Related
None.
Example
#include <Array.au3>
Dim $avArray[5]
$avArray[0] = "ab"
$avArray[1] = "bc"
$avArray[2] = "cd"
$avArray[3] = "de"
$avArray[4] = "ef"
$aNewArray = _ArrayTrim( $avArray, 1, 1,1,3)
_ArrayDisplay($aNewArray,"demo _ArrayTrim")
Exit
;The new array in order should now be "a", "b" , "c" , "d", "e".